You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some edge cases like the cloud-sql-proxy, an SSL configuration mismatch (i.e. server not having SSL enabled, but client is forcing it) will result in a generic (2013, 'Lost connection to MySQL server during query') error. This error unfortunately can mean many things, but to help the user diagnose a potential issue this PR adds an error message to check SSL configuration if the error persists.
Resolves#1584 (with additional help from PR #1591)
Checklist
I added this contribution to the changelog.md file.
I added my name to the AUTHORS file (or it's already there).
To lint and format the code, I ran
uv run ruff check && uv run ruff format && uv run mypy --install-types .
Potential crash on malformed OperationalError args
In _connect, all branches index e1.args[0] without guarding for empty/short args. If pymysql raises an OperationalError with no args (it can happen in some driver edge cases), this will raise IndexError and hide the original failure. Consider guarding or using a helper like code = e1.args[0] if e1.args else None. This isn’t new in this PR, but this change adds another branch that relies on it, making the risk more visible.
File: mycli/main.py:704
Missing test for new user-facing message
The new behavior is user-visible and should be verified. Add a unit test that forces SQLExecute to raise OperationalError with CR_SERVER_LOST and assert the extra guidance text is emitted. A CliRunner test can monkeypatch SQLExecute in test/test_main.py to simulate the error.
File: test/test_main.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In some edge cases like the cloud-sql-proxy, an SSL configuration mismatch (i.e. server not having SSL enabled, but client is forcing it) will result in a generic
(2013, 'Lost connection to MySQL server during query')error. This error unfortunately can mean many things, but to help the user diagnose a potential issue this PR adds an error message to check SSL configuration if the error persists.Resolves #1584 (with additional help from PR #1591)
Checklist
changelog.mdfile.AUTHORSfile (or it's already there).